﻿@model ShoppingCartModel.ShoppingCartItemModel
@using Nop.Web.Models.ShoppingCart;

<tr class="cart-store-item @if (Model.Warnings.Count > 0){<text>error</text>}" data-id="@Model.ProductId" data-sci="@Model.Id">
    <td class="product-mobile-title"><a href="@Url.RouteUrl("Product", new { SeName = Model.ProductSeName })" title="@Model.Picture.Title">
    <h5>@Model.ProductName</h5>
</a></td>
    <td class="product-picture">
        <a href="@Url.RouteUrl("Product", new { SeName = Model.ProductSeName })" title="@Model.Picture.Title">
            <img alt="@Model.Picture.AlternateText" src="@Model.Picture.ImageUrl" title="@Model.Picture.Title" class="img-responsive" />
        </a>
    </td>
    <td class="product-info">
        <div class="cart-store-item-name">
            <a href="@Url.RouteUrl("Product", new { SeName = Model.ProductSeName })" title="@Model.Picture.Title">
                <h5>@Model.ProductName</h5>
            </a>
        </div>
        <div class="cart-store-item-detail">
            @if (!String.IsNullOrEmpty(Model.Sku))
            {
                @Model.Sku
            }

            @if (!String.IsNullOrEmpty(Model.AttributeInfo))
            {
                <div class="attributes">

                    @Html.Raw(Model.AttributeInfo)
                </div>
            }
            @if (!String.IsNullOrEmpty(Model.RecurringInfo))
            {
                <div class="recurring-info">
                    @Html.Raw(Model.RecurringInfo)
                </div>
            }
            @if (Model.Warnings.Count > 0)
            {
                <div class="cart-item-message-error">
                    <ul>
                        @for (int i = 0; i < Model.Warnings.Count; i++)
                        {
                            <li>@Model.Warnings[i]</li>
                        }
                    </ul>
                </div>
            }
        </div>
    </td>
    <td class="product-unit">
        <span class="product-mobile-label">Unit</span>
        @Model.UnitPricePrimary
    </td>
    <td class="cart-store-items-quantity product-qty">
        <span class="product-mobile-label">Qty</span>
        <div class="product-quantity" data-quantity="@Model.Quantity">
            @if (Model.IsEditable)
            {
                <div class="">
                    <div class="product-quantity-editor input-group">
                        <span class="input-group-addon minus">-</span>
                        <input class="form-control" @if (Model.MaxQuantity > 0) { <text> data-max="@Model.MaxQuantity" </text> } @if (Model.MinQuantity > 0) { <text> data-min="@Model.MinQuantity" </text> } type="text" data-url="@Url.Action("EditItemInCart", "ShoppingCart")" data-orig="@Model.Quantity" value="@Model.Quantity" data-name="itemQuantity" data-name2="sciId" data-value2="@Model.Id" data-name3="storeId" data-value3="@Model.Store.Id" />
                        <span class="input-group-addon plus">+</span>
                    </div>
                    <div class="cart-item-update-button">
                        <input type="button" value="Update" class="ui-btn btn-normal update-cart-item" />
                    </div>
                    <div class="cart-item-loading">
                        <img class="loading-svg" src="/Content/images/loading.svg" />
                        <img class="loading-gif" src="/Content/images/loading.gif" /><br />
                        <span class="cart-item-loading-message">@T("Common.Loading")</span>
                    </div>
                </div>
            }
            else
            {
                <span>@Model.Quantity</span>
            }
        </div>
    </td>
    <td class="cart-store-items-total product-total">
        <span class="product-mobile-label">Total</span>
        @Model.SubTotal
    </td>
    <td class="product-mobile-attributes">
        @if (!String.IsNullOrEmpty(Model.Sku))
        {
            @Model.Sku
        }

        @if (!String.IsNullOrEmpty(Model.AttributeInfo))
        {
            <div class="attributes">

                @Html.Raw(Model.AttributeInfo)
            </div>
        }
        @if (!String.IsNullOrEmpty(Model.RecurringInfo))
        {
            <div class="recurring-info">
                @Html.Raw(Model.RecurringInfo)
            </div>
        }
        @if (Model.Warnings.Count > 0)
        {
            <div class="cart-item-message-error">
                <ul>
                    @for (int i = 0; i < Model.Warnings.Count; i++)
                    {
                        <li>@Model.Warnings[i]</li>
                    }
                </ul>
            </div>
        }
    </td>
    @if (Model.IsEditable)
    {
        <td class="product-remove">
            <span class="cart-store-items-remove" data-url="@Url.Action("EditItemInCart", "ShoppingCart")" data-name="itemQuantity" data-value="0" data-name2="sciId" data-value2="@Model.Id" data-name3="storeId" data-value3="@Model.Store.Id">
                <span class="remove"><i class="fa fa-trash-o"></i></span>
            </span>
        </td>
    }
</tr>
